
/*
14-7 In NameHiding.cpp, verify that in Derived2, Derived3, and Derived4, none of the base-class versions of f( ) are available.
*/
#include <iostream>
#include <string>

using namespace std;

class Base {
public:
	int f() const { 
		cout << "Base::f()\n"; 
		return 1; 
	}
	int f(string) const { return 1; }
	void g() {}
};

class Derived1 : public Base {
public:
	void g() const {}
};

class Derived2 : public Base {
public:
	// Redefinition:
	int f() const { 
		cout << "Derived2::f()\n"; 
		return 2;
	}
};

class Derived3 : public Base {
public:
	// Change return type:
	void f() const { cout << "Derived3::f()\n"; }
};

class Derived4 : public Base {
public:
	// Change argument list:
	int f(int) const { 
		cout << "Derived4::f()\n"; 
		return 4; 
	}
};

int main() {
	Derived2 d2;
	d2.f();
	//error: d2.f('1');
	
	Derived3 d3;
	d3.f();
	//error: d3.f('1');
	
	Derived4 d4;
	d4.f(2);
	//error: d4.f();
	d4.f('2');
	
}